Repository navigation
fix: use window center for shortcuts popup position - #702
pppanghu77 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pppanghu77 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves an incorrect screen-center overwrite in Window::displayShortcuts(), allowing the shortcuts popup to use the window’s geometric center while preserving screen selection for multi-monitor scenarios. Sequence diagram for shortcuts popup positioningsequenceDiagram
actor User
participant Window
participant QtScreen
participant ShortcutViewer
User->>Window: displayShortcuts()
Window->>QtScreen: screenAt(QCursor::pos())
QtScreen-->>Window: screen
Window->>Window: calculate window geometry center
Window->>ShortcutViewer: launch with window center position
ShortcutViewer-->>User: show shortcuts popup centered on window
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Root cause: displayShortcuts() calculated window center at line 2574-2575 but then overwrote it with screen center via screen->geometry().center() at line 2593, causing the popup to center on the full screen instead of the window 2. Fix: remove the pos = screen->geometry().center() override line, keeping the screen selection logic for multi-monitor support while using window center as the position 3. Impact: shortcuts popup now centers on the editor window instead of screen center; fixes occlusion in split-screen mode where screen center falls on the split boundary Log: Fix shortcuts popup occlusion in split-screen mode Influence: 1. Test shortcuts popup position in single-screen mode 2. Test shortcuts popup position in split-screen mode 3. Test shortcuts popup position in multi-monitor mode fix: 修复分屏模式下快捷键帮助浮窗遮挡问题 1. 根因:displayShortcuts() 在第 2574-2575 行计算了窗口中心 坐标,但第 2593 行用 screen->geometry().center() 覆盖为 屏幕中心,导致浮窗以整屏中心定位而非窗口中心 2. 方案:删除 pos = screen->geometry().center() 覆盖行,保留 屏幕选择逻辑用于多显示器场景,定位坐标使用窗口中心 3. 影响:快捷键帮助浮窗以编辑器窗口中心定位,修复分屏模式 下浮窗定位于分屏分界线导致的遮挡问题 Log: 修复分屏模式下快捷键帮助浮窗遮挡问题 Influence: 1. 测试单屏模式下快捷键帮助浮窗定位 2. 测试分屏模式下快捷键帮助浮窗定位 3. 测试多显示器场景下快捷键帮助浮窗定位 Bug: #189255
5d9825b to
51114ac
Compare
|
TAG Bot New tag: 6.6.10 |
|
TAG Bot New tag: 6.6.11 |
|
TAG Bot New tag: 6.6.12 |
|
TAG Bot New tag: 6.6.13 |
Root Cause Analysis
In
Window::displayShortcuts()(src/widgets/window.cpp), the shortcuts popup position was first correctly calculated as the window's geometric center (lines 2574–2575), but then overwritten byscreen->geometry().center()at line 2591 (introduced by commit5d0074a2). In split-screen mode the full-screen center falls exactly on the split boundary, causingdeepin-shortcut-viewerto center the popup on the boundary — producing partial occlusion and a visible reposition animation by the compositor. See analysis-report.md §6 for the root-cause conclusion.Fix Approach
Remove the
pos = screen->geometry().center()override line, keeping the screen-selection logic (QGuiApplication::screenAt(QCursor::pos())etc.) for multi-monitor support while using the window center as the positioning coordinate. This aligns with thedeepin-shortcut-viewer --helpdocumentation, which states-pshould be "your window's central position". See analysis-report.md §10 for the fix recommendation.Change Safety Assessment
Code Safety
5d0074a2(not a historical bug fix); removing it does not revert any prior bug fix. Screen-selection logic is preserved, only the position override is deleted.displayShortcuts()is a private slot invoked only by the Qt signal system; no external callers are affected.Business Impact Scope
Ctrl+Shift+?) — the popup now centers on the editor window instead of the full screen center.Verification Suggestion
根因分析
Window::displayShortcuts()(src/widgets/window.cpp)在第 2574–2575 行正确计算了窗口几何中心坐标,但第 2591 行用screen->geometry().center()覆盖了该值(由 commit5d0074a2引入)。在分屏模式下,整屏中心恰好位于分屏分界线上,导致deepin-shortcut-viewer以分界线为中心定位浮窗,产生遮挡和合成器重定位动画。详见 analysis-report.md 第六节。修复方案
删除
pos = screen->geometry().center()覆盖行,保留屏幕选择逻辑(QGuiApplication::screenAt(QCursor::pos())等)用于多显示器场景确定目标屏幕,定位坐标使用窗口中心。这与deepin-shortcut-viewer --help文档一致(-p参数为 "your window's central position")。详见 analysis-report.md 第十节。改动安全评估
代码安全评估
5d0074a2引入(非历史 bug 修复),删除不撤销任何已有 bug 修复。屏幕选择逻辑保留,仅删除位置覆盖行。displayShortcuts()为私有槽函数,仅由 Qt 信号系统调用,无外部调用者受影响。业务影响范围
Ctrl+Shift+?)— 浮窗现以编辑器窗口中心定位,而非整屏中心。验证建议
Summary by Sourcery
Bug Fixes: